import axios from 'axios'
import * as constants from './constants'

const setDetail = (result)=>({
    type:constants.SET_DETAIL,
    title:result.title,
    content:result.content
})

export const getDetailData = (id)=>{
    return (dispatch)=>{
        axios.get(`/api/detail.json?id=${id}`).then(res=>{
           console.log(res)
           dispatch(setDetail(res.data.data))  
        }).catch(err=>err)
    }
}